import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import UnoCSS from "unocss/vite";
import { codeInspectorPlugin } from "code-inspector-plugin";
import path from 'path';
export default defineConfig({
  plugins: [
    vue(),
    UnoCSS(),
    codeInspectorPlugin({
      bundler: "vite",
    }),
  ],
  // base: import.meta.env.VITE_PUBLIC_PATH,
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'), // 使用 @ 指向 src 目录
    },
  },
  server: {
    proxy: {
      port: "5000",
      // 字符串简写写法
      "/foo": "http://localhost:4567",
      // 选项写法
      "/api": {
        target: "http://jsonplaceholder.typicode.com",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
  /*主要看下面这段*/
  css: {
    preprocessorOptions: {
      scss: {
        // additionalData: '@import "@/styles/constant.scss";',
      },
    },
  },
});
